package customer

import (
	"server/global"
)

type CustomerFileModel struct {
	global.TD27_MODEL
	CustomerID uint          `json:"customerID" gorm:"not null;uniqueIndex:idx_customerId_name_size;comment:客户ID;index" validate:"required"`
	Customer   CustomerModel `gorm:"foreignKey:CustomerID" validate:"required"`
	Name       string        `json:"fileName" gorm:"not null;uniqueIndex:idx_customerId_name_size;comment:文件显示名;" validate:"required"`
	Size       int64         `json:"fileSize" gorm:"not null;uniqueIndex:idx_customerId_name_size;comment:文件大小;" validate:"required"`
	Key        string        `json:"fileKey" gorm:"not null;comment:存储在S3上的文件名" validate:"required"`
	Desc       string        `json:"description" gorm:"type:text;comment:事件内容"`
}

func (CustomerFileModel) TableName() string {
	return "customer_file"
}

type ChunkUploadModel struct {
	global.TD27_MODEL
	UploadID   string `gorm:"not null;uniqueIndex:idx_uploadId_partNumber;" validate:"required"`
	ETag       string `gorm:"not null;" validate:"required"`
	PartNumber int64  `gorm:"not null;uniqueIndex:idx_uploadId_partNumber;" validate:"required"`
	FileHash   string `gorm:"not null;" validate:"required"`
}

func (ChunkUploadModel) TableName() string {
	return "chunk_upload_metadata"
}
